home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
C-H
/
Finder Progress Pascal.cpt
/
Finder Progress Pascal
/
Finder Progress.p
next >
Wrap
Text File
|
1993-01-03
|
2KB
|
77 lines
program FinderProgress;
{ Finder Progress }
{ by Joe Zobkiw}
{ This is a simple THINK Pascal 4.0.1 project and compiled application }
{ that shows you how to (very easily) implement a Finder 7-like }
{ progress meter. I have only seen cheap imitations on the nets so }
{ I decided to code one that looks a little closer to how the Finder }
{ does. }
{ You can extend this code in any way you wish, make it movable modal, }
{ do with it what you will, it should work in almost any scenario. }
{ If you make any changes please send them to me at any of the }
{ following addresses. Enjoy, and please give this to your friends. }
{ America Online: AFL Zobkiw}
{ Internet: zobkiw@world.std.com}
{ Pascal translation by Mike Epstein (America Online: MEpstein, Internet: mepstein@aol.com)}
uses
Routines;
var
d: DialogPtr;
savePort: GrafPtr;
R: Rect;
i: Integer;
theDepth: Integer;
someTime: LongInt;
itemHit: Integer;
begin
SetCursor(arrow);
GetDateTime(randSeed);
FlushEvents(everyEvent, 0);
DrawMenuBar;
{show the about alert}
itemHit := Alert(kAboutAlertID, nil);
{get the dialog box}
d := GetNewDialog(kModalProgressDialogID, nil, WindowPtr(-1));
if d = nil then
ExitToShell;
{set up the port for drawing}
GetPort(savePort);
SetPort(d);
ParamText('Now doing something time consuming…', '', '', '');
ShowWindow(d);
DrawDialog(d);
{if this isn’t available, we are toast anyway!}
SetCursor(GetCursor(watchCursor)^^);
{get the rectangle of the progress item and the current bitdepth}
r := DItemRect(d, kDialogProgressItem);
theDepth := BitDepth;
{now we’re making progress!}
for i := 1 to 100 do
begin
UpdateProgress(r, i, (bitDepth >= kColorBitDepth));
Delay(2, someTime);
end;
{clean things up}
InitCursor;
ParamText('', '', '', '');
DisposeDialog(d);
SetPort(savePort);
end.